<TMPL_VAR NAME=PAGE_CONTENT>
<small><TMPL_VAR NAME=RESPONSE_TIME></small>

<!-- add session links to all links -->
<script type="text/javascript">

RegExp.escape = function(text) {
  if (!arguments.callee.sRE) {
    var specials = [
      '/', '.', '*', '+', '?', '|',
      '(', ')', '[', ']', '{', '}', '\\'
    ];
    arguments.callee.sRE = new RegExp(
      '(\\' + specials.join('|\\') + ')', 'g'
    );
  }
  return text.replace(arguments.callee.sRE, '\\$1');
}

var sessionLink= "<TMPL_VAR NAME=SESSION_LINK_JS>";
var baseURL= "<TMPL_VAR NAME=CGI_BASE_URL>";
var baseRE = new RegExp(RegExp.escape(baseURL));
if (sessionLink != "") {
	for (i=0; i < document.links.length; i++) {
		if (document.links[i].href.substr(0,9).toLowerCase()=="javascript") {
			continue;
		}
		if (document.links[i].href.match(/wrSID\=/) != null) {
			continue;
		}
		if (document.links[i].href.match(baseRE) != null) {
			var pos= document.links[i].href.indexOf('#');
			if (pos != -1) {
				document.links[i].href= document.links[i].href.substring(0,pos) + sessionLink
					+ document.links[i].href.substring(pos,document.links[i].href.length);
			} else {
				document.links[i].href= document.links[i].href + sessionLink;
			}
		}
	}
}
</script> 

</body>
</html> 
